package com.scy.common;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

/**
 * 本类用来演示
 *
 * @author wwh
 * @date 2024/6/26 11:42 $
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
public class Result {
    private int code;

    private String msg;

    private Object data;

    public static Result ok(Object data){

        return new Result(200,"ok",data);

    }

    public static Result ok(String msg, Object data){

        Result result = new Result(200,msg,data);

        return result;

    }

    public static Result fail(String msg){
        Result result = new Result();

        result.code = 500;

        result.msg = msg;

        return result;

    }
    public static Result fail(int code,String msg){
        Result result = new Result();

        result.code = code;

        result.msg = msg;

        return result;

    }
}
